package servlet.zj;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.DAOFactory;
import dao.zj.BrandDao;
import entity.Brand;

/**
 * Servlet implementation class UpdateBrandServlet
 */
@WebServlet("/UpdateBrandServlet")
public class UpdateBrandServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private BrandDao one=DAOFactory.createBrandDAO();

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		Brand brand=new Brand();
		int id=Integer.parseInt(request.getParameter("a"));
		String name=request.getParameter("brand_name");
		brand.setBrandId(id);
		brand.setBrandName(request.getParameter("brand_name"));
		brand.setBrandUrl(request.getParameter("brand_url"));
		brand.setBrandDescribe(request.getParameter("brand_desc"));
		one.updatebrand(brand);
		request.getRequestDispatcher("jump2.jsp?brandName="+name).forward(request, response);
	}
}
